import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex);

const store = new Vuex.Store({
	state: {
		user: uni.getStorageSync('user'),
		book: uni.getStorageSync('book'),
		token: uni.getStorageSync('token')
	},
	mutations: {
		user(state, user) {
			state.user = user
		},
		book(state, book) {
			state.book = book
		},
		token(state, token) {
			state.token = token
		},
	},
	getters: {
		user: state => state.user,
		book: state => state.book,
		token: state => state.token,
	}
})
export default store